import numpy as np
import cv2

# 加载相机内部参数和畸变参数
camera_matrix = np.load('camera_matrix.npy')
dist_coeffs = np.load('dist_coeffs.npy')

# 加载原始图像
image = cv2.imread('image.jpg')

# 进行校正
undistorted_image = cv2.undistort(image, camera_matrix, dist_coeffs)

# 显示校正后的图像
cv2.imshow('Undistorted Image', undistorted_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
